package com.lovo.service;

import com.lovo.dao.IMovieDao;
import com.lovo.entity.MovieEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SchedulingService {
    @Autowired
    IRemoteService remoteService;
    @Autowired
    IMovieDao movieDao;
  @Scheduled(fixedDelay = 3000)
//  @Scheduled(cron = "0 42 10 ? * MON-FRI")
    public void  printInfo(){
      this.movieEntityList();
   }
   public List<MovieEntity> movieEntityList(){
       List<MovieEntity> list=  remoteService.movieList();
       movieDao.saveAll(list);
       return  list;
   }


}
